/**
 * Created by porco on 16/12/29.
 */
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRedirect, IndexRoute, browserHistory, withRouter, applyRouterMiddleware } from 'react-router';

import Games from '../../client/pages/Games';
import Sudoku from '../../client/pages/Sudoku';
import ElasticBall from '../../client/pages/ElasticBall';
import Gobang from '../../client/pages/Gobang';
import Test from '../../client/test/Test';

Meteor.startup(() => {
    Tracker.autorun((c) => {
        render(
            <Router history={browserHistory}>
                <Route path="/" >
                    <IndexRedirect to="/games" />
                    <Route path="games" component={withRouter(Games)} />
                    <Route path="sudoku" component={withRouter(Sudoku)} />
                    <Route path="elastic-ball" component={withRouter(ElasticBall)} />
                    <Route path="gobang" component={withRouter(Gobang)} />

                    <Route path="test" component={Test} />
                </Route>
            </Router>,
            document.getElementById('games')
        );
        c.stop();
    });
});
